<?php
//   echo "PRIMA RIGA " . date( "d/m/Y h.m.s ", time() ) ."<br>";

   //defined('_JEXEC') or die('Restricted access');
    $loacl_start_time = time();

	define( '_JEXEC', 1 );
    //echo 'root_page:'.$_SERVER['REQUEST_URI']."<br>";
    //echo $_SERVER['QUERY_STRING'];
    require('ce'.DIRECTORY_SEPARATOR."namespaces".DIRECTORY_SEPARATOR."ambient_namespace.php");
    global $g_url_parameters_namespace;
    //
    try
    {
		global $g_ambient_namespace;
        $g_ambient_namespace->edit_mode = true;

        //
        //require_once(CUTEENGINE_NAMESPACES_PATH."strings_utility_namespace.php");
        require_once(CUTEENGINE_NAMESPACES_PATH."database_namespace.php");
        require_once(CUTEENGINE_PATH_SITES.$g_url_parameters_namespace->current_site.DIRECTORY_SEPARATOR.$g_url_parameters_namespace->current_site.'.php');        //
        require_once(CUTEENGINE_BASE_COMPONENTS_PATH."cuteengine_class.php");
        
    }
    catch (Exception $e) 
    {
        add_log_error($e);
    }

   // ob_end_clean();
    //
    try
    {	
	
        t_cuteengine::create_cuteengine();
       // echo "create OK";
        global $g_cuteengine;

        $g_cuteengine->execute();
	}
	catch(Exception $e)
	{
		//$this->log->add_log_error($e,debug_backtrace(),true);    
	}     
    
	//
    global $g_ambient_namespace;
	global $g_javascript_namespace;
  //  global $g_cuteengine->actions_list;
	$local_user_agent = $g_javascript_namespace->user_agent;
	$loacl_end_time = time(); 
	$interval = $loacl_end_time - $loacl_start_time;
    $local_parameter = $g_url_parameters_namespace->get_parameter_by_position(0);
	//echo "count action_list:". count($g_cuteengine->actions_list) . "<br>";
    //if (((isset($local_parameter)) && ($local_parameter->component_id == 161)) || ((($g_ambient_namespace->log->error_count() > 0) || (($interval >= 3) && ($g_url_parameters_namespace->current_site != 'offline')  && ($g_url_parameters_namespace->current_site != 'admin'))) &&
	//echo "error count:". count($g_ambient_namespace->log->error_count()) . "<br>";
      //  ((! isset($local_parameter)) || ($local_parameter->component_id != 35))))
    if ((($g_ambient_namespace->log->error_count() > 0) || (($interval >= 5) && ($g_url_parameters_namespace->current_site != 'offline')  && ($g_url_parameters_namespace->current_site != 'admin') &&
        ((! isset($local_parameter)) || ($local_parameter->component_id != 35)))))	  
    {
       $g_ambient_namespace->log->add_log_on_page("g_url_parameters_namespace->fast_parameter : ".$g_url_parameters_namespace->fast_parameter,true);
	   mail('cristian.rustichelli@gmail.com', 'diff: '. $interval .' sec - '.date( "d/m/Y H.i.s",$loacl_start_time ) .' - '.  date( "d/m/Y H.i.s",$loacl_end_time ) .' - ' . $local_user_agent->browser.' - ' . $local_user_agent->browser_version .' - '.$_SERVER['REQUEST_URI'],$g_ambient_namespace->log->report_log,"From: TEST");   

      // mail('cristian.rustichelli@gmail.com', $loacl_start_time .' - '. $loacl_end_time .' - ' . $local_user_agent->browser.' - ' . $local_user_agent->browser_version .' - '.$_SERVER['REQUEST_URI'],$g_ambient_namespace->log->report_log,"From: TEST");   
    }
    //echo "serialize: ".serialize($g_cuteengine->actions_list);*/


?>